<%--
  User: zhangteng
  Date: 2015/1/4 19:04
--%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <title>管理员登录页面</title>
    <%@include file="../common/head.jsp" %>
</head>

<body class="login-layout">
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h3>
                            <i class="icon-leaf green"></i>
                            <span class="red">音像商店管理系统</span>
                            <span class="white">后台管理</span>
                        </h3>
                        <h4 class="blue">管理员登录入口</h4>
                    </div>

                    <div class="space-6"></div>

                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="icon-coffee green"></i>
                                        请输入您的信息
                                    </h4>

                                    <div class="space-6"></div>

                                    <form method="post" action="${website}admin/login">
                                        <fieldset>
                                            <c:if test="${!empty msg}">
                                                <div class="alert alert-danger">
                                                    <button data-dismiss="alert" class="close" type="button">
                                                        <i class="icon-remove"></i>
                                                    </button>

                                                    <strong>
                                                        <i class="icon-remove"></i>
                                                        Oh No!
                                                    </strong>
                                                    用户名或密码不正确！
                                                    <br>
                                                </div>
                                            </c:if>
                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" class="form-control" placeholder="用户名"
                                                                   name="username" value="" />
															<i class="icon-user"></i>
														</span>
                                            </label>

                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" class="form-control" placeholder="密码"
                                                                   name="pwd" value="" />
															<i class="icon-lock"></i>
														</span>
                                            </label>

                                            <div class="space-24"></div>

                                            <div class="clearfix">
                                                <button type="reset" class="width-30 pull-left btn btn-sm">
                                                    <i class="icon-refresh"></i>
                                                    重置
                                                </button>

                                                <button type="submit"
                                                        class="width-65 pull-right btn btn-sm btn-primary">
                                                    登录
                                                    <i class="icon-arrow-right icon-on-right"></i>
                                                </button>
                                            </div>
                                        </fieldset>
                                    </form>
                                </div>
                                <!-- /widget-main -->
                            </div>
                            <!-- /widget-body -->
                        </div>
                        <!-- /login-box -->

                    </div>
                    <!-- /position-relative -->
                </div>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
</div>
<!-- /.main-container -->

<%@include file="../common/footer.jsp"%>
<script type="text/javascript" src="${staticWebsite}js/jquery.validate.min.js"></script>
<script type="text/javascript">
    $(function ($) {
        $('form').validate({
            errorElement: 'div',
            errorClass: 'help-block',
            focusInvalid: false,
            rules: {
                username: {
                    required: true
                },
                pwd: {
                    required: true
                }
            },

            messages: {
                username: {
                    required: "请输入用户名"
                },
                pwd: {
                    required: "请输入密码"
                }
            },
            invalidHandler: function (event, validator) { //display error alert on form submit
                $('.alert-danger').show();
            },
            highlight: function (e) {
                $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
            },
            success: function (e) {
                $(e).closest('.form-group').removeClass('has-error').addClass('has-info');
                $(e).remove();
            },
            errorPlacement: function (error, element) {
                error.insertAfter(element.parent());
            },
            submitHandler: function (form) {
                form.submit();
            },
            invalidHandler: function (form) {
            }
        });
    });
</script>

</body>
</html>
